#include "common.h"
PUBLIC S4B ByteToPort(U2B port,U1B content)
{
   __asm__ __volatile__(
        "outb %%al,%%dx\n\t"
        "nop\n\t"
        "nop\n\t"
        "nop\n\t"
        "nop\n\t"
        "nop\n\t"
        :
        :"a"(content),"d"(port));
   return ARTIST_ERROR_OK;
}

PUBLIC S4B ByteFromPort(U2B port)
{
   U1B content=0;
   __asm__ __volatile__(
        "inb %%dx,%%al\n\t"
        "nop\n\t"
        "nop\n\t"
        "nop\n\t"
        "nop\n\t"
        "nop\n\t"
        :"=a"(content)
        :"d"(port));
   return content;
}


PUBLIC S4B ReadPortWords(U2B port,U2B wordnumber,PU2B buffer)
{
   __asm__ __volatile__(
       "cld\n\t"
       "rep insw\n\t"
   :
   :"d"(port),"D"(buffer),"c"(wordnumber)
   :"memory");
   return ARTIST_ERROR_OK;
}

PUBLIC S4B WritePortWords(U2B port,U2B wordnumber,PU2B buffer)
{
   __asm__ __volatile__(
       "cld\n\t"
       "rep outsw\n\t"
   :
   :"d"(port),"S"(buffer),"c"(wordnumber));
   return ARTIST_ERROR_OK;
}



